TARGET = dummy_server refresh_stat test_sanitize

SRC = dummy_server.c refresh_stat.c test_sanitize.c 
OBJ = $(SRC:.c=.o)

CFLAGS = -Wall -g
CFLAGS += `pkg-config --cflags glib-2.0`

LFLAGS += -lpthread
LFLAGS += `pkg-config --libs glib-2.0`

all default: ${TARGET}

dummy_server: dummy_server.o
	$(CC) ${LFLAGS} -o $@ $^

refresh_stat: refresh_stat.o
	$(CC) ${LFLAGS} -o $@ $^

test_sanitize: test_sanitize.o
	$(CC) ${LFLAGS} -o $@ $^

# pull in dependency info for *existing* .o files
-include $(SRC:.c=.d)

# generate dependency info
%.d : %.c
	$(CC) $< -MM $(CFLAGS)  > $*.d

# compile
%.o : %.c
	$(CC) $< -c  $(CFLAGS) -o $*.o

clean: 
	-rm -rf ${OBJ} $(OBJ:.o=.d) ${TARGET}
